﻿// owner 蒋家伟

#pragma once
#include "FieldReflectDeclare.h"

// DBSchemaObject的部分部分纯虚方法的实现
#define DBSCHEMAOBJECT_VIRTUAL_FUN_DECLARE(NAMESAPCE, CLASSNAME) \
public:\
virtual const UniqueId& getClassId() const override;\
virtual const std::wstring& getClassName() const override;\
virtual bool serialize(JsonDocument& jsonDoc, JsonObject& jsonObject) const override;\
virtual bool unserialize(const JsonObject& jsonObject) override;


// 类支持反射的声明
#define OBJECT_REFLECT_DECLARE(NAMESAPCE, CLASSNAME , UID_STR) \
public:\
CLASSNAME(); \
static const UniqueId& getReflectUid(); \
DBSCHEMAOBJECT_VIRTUAL_FUN_DECLARE(NAMESAPCE, CLASSNAME) \
FIELD_REFLECT_DECLARE(CLASSNAME) \
private:\
static constexpr wchar_t* getReflectUidStr()\
{\
return UID_STR; \
}\
static bool s_##CLASSNAME##_reflect_object_register;

#define OBJECT_SERIALIZE_DECLARE_DERIVED1(NAMESAPCE, CLASSNAME, UID_STR , BASECLASS1)\
DEFINE_DRIVER_FROM(CLASSNAME, BASECLASS1)\
OBJECT_REFLECT_DECLARE(NAMESAPCE, CLASSNAME, UID_STR)

#define OBJECT_SERIALIZE_DECLARE_DERIVED2(NAMESAPCE, CLASSNAME, UID_STR , BASECLASS1, BASECLASS2)\
DEFINE_DRIVER_FROM2(CLASSNAME, BASECLASS1, BASECLASS2) \
OBJECT_REFLECT_DECLARE(NAMESAPCE, CLASSNAME, UID_STR)

#define OBJECT_SERIALIZE_DECLARE_DERIVED3(NAMESAPCE, CLASSNAME, UID_STR , BASECLASS1, BASECLASS2, BASECLASS3)\
DEFINE_DRIVER_FROM3(CLASSNAME, BASECLASS1, BASECLASS2, BASECLASS3) \
OBJECT_REFLECT_DECLARE(NAMESAPCE, CLASSNAME, UID_STR)
